import { Base } from '../utils/base.js';

class Cart extends Base {
    constructor() {
        super();
    }
	
	//添加购物车
	add_cart(data,callback){
		var params = {
		    url: 'cart/add',
		    type: 'post',
		    loading: true,
			data:data
		};
		this.apiRequest(params, callback);
	}
	
	//修改购物车
	update_cart(data,callback){
		var params = {
		    url: 'cart/update',
		    type: 'post',
		    loading: true,
			data:data
		};
		this.apiRequest(params, callback);
	}
	//收藏/取消收藏
	collect(data,callback){
		var params = {
		    url: 'cart/collect',
		    type: 'get',
		    loading: true,
			data:data
		};
		this.apiRequest(params, callback);
	}
	//产品分享二维码
	qrcode(data,callback){
		var params = {
		    url: 'cart/qrcode',
		    type: 'get',
		    loading: true,
			data:data
		};
		this.apiRequest(params, callback);
	}
	//购物车列表
	get_cart_list(callback){
		var params = {
		    url: 'cart/getList',
		    type: 'get',
		    loading: true
		};
		this.apiRequest(params, callback);
	}
	//删除购物车
	del_cart(data,callback){
		var params = {
		    url: 'cart/del',
		    type: 'post',
		    loading: true,
			data:data
		};
		this.apiRequest(params, callback);
	}
}

export { Cart };
